//
//  CourseDetailsLecturerViewController.m
//  ZFPlayer_Example
//
//  Created by 洪欣 on 2019/1/9.
//  Copyright © 2019年 紫枫. All rights reserved.
//

#import "CourseDetailsLecturerView.h"
#import <UIImageView+WebCache.h>

@interface CourseDetailsLecturerView ()
//@property (weak, nonatomic) IBOutlet UIImageView *userPicView;
//@property (weak, nonatomic) IBOutlet UILabel *userNameLb;
//@property (weak, nonatomic) IBOutlet UILabel *contentLb;
//@property (weak, nonatomic) IBOutlet UILabel *titleLb;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *userPicViewTop;

@end

@implementation CourseDetailsLecturerView

+ (instancetype)initView {
    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil] lastObject];
}

- (void)awakeFromNib {
    [super awakeFromNib];
//    self.titleLb.text = @"讲师介绍";
//    self.titleLb.hidden = NO;
    
}

- (void)setModel:(CourseDetailsLecturerDataModel *)model {
    _model = model;
    
    self.userNameLb.text = model.teacherName;
    NSString *url;
    [self.userPicView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",Public_URL,model.teacherImage]]];
    
    self.contentLb.text = model.teacherInfo;
    
    [self layoutIfNeeded];
    CGRect rect = self.frame;
    rect.size.height = CGRectGetMaxY(self.contentLb.frame) + 20;
    self.frame = rect;
}

- (void)setIndex:(NSInteger)index {
    _index = index;
    if (index == 0) {
        self.titleLb.hidden = NO;
    }else {
        self.userPicViewTop.constant = 10.f;
        self.titleLb.hidden = YES;
    }
}


@end
